package com.wangijun.yuan.web.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangijun.yuan.core.domain.Article;
import com.wangijun.yuan.web.model.vo.ArticleContentVO;
import com.wangijun.yuan.web.model.vo.CreationArticleVO;
import com.wangijun.yuan.web.model.vo.MainArticleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {
    List<MainArticleVO> articleList(@Param(Constants.WRAPPER) Wrapper<?> wrapper);

    List<CreationArticleVO> creationArticleList(@Param(Constants.WRAPPER) Wrapper<?> wrapper);

    int readNumAdd(@Param("id") Long id, @Param("num") Integer num);

    int starAdd(@Param("id") Long id, @Param("num") Integer num);

    int favoritesAdd(@Param("id") Long id, @Param("num") Integer num);

    int commentAdd(@Param("id") Long id, @Param("num") Integer num);

    Page<Article> query(@Param("param") String param, @Param("order") String order, @Param("page") Page<Article> page);

    ArticleContentVO articleData(@Param("id") Long id);
}